﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    public int i = 0;
    public int ad = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.Repeater4.ItemDataBound += new RepeaterItemEventHandler(Repeater4_ItemDataBound);
            ShowData();
        }
    }

    void Repeater4_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Forum.Entities.forum_muluinfo model = e.Item.DataItem as Forum.Entities.forum_muluinfo;
        if (model != null)
        {
            string where = " body_muluid=" + model.MuLu_ID.ToString();

            Repeater rp = (Repeater)e.Item.FindControl("Repeater41");//左边图片推荐显示控件
            if (rp != null)
            {
               rp.DataSource = WebBase.CacheRepository.forum_body.GetPaged(where, "body_fangwen desc", 0, 10);
               rp.DataBind();
            }


            //where = " body_muluid=" + model.MuLu_ID.ToString();
            rp = (Repeater)e.Item.FindControl("Repeater42");//左边图片推荐显示控件
            if (rp != null)
            {
                rp.DataSource = WebBase.CacheRepository.forum_body.GetPaged(where, "body_id desc", 0, 5);
                rp.DataBind();
            }
        }
    }


    public void ShowData()
    {
        string where = " mulu_name='文章分类' ";
        Forum.Entities.forum_muluinfo model = WebBase.CacheRepository.forum_mulu.Get(where);
        if (model != null)
        {
            where = "mulu_fuid=" + model.MuLu_ID.ToString();
            this.Repeater4.DataSource = WebBase.CacheRepository.forum_mulu.GetPaged(where, " mulu_id desc ", 0, 9);
            this.Repeater4.DataBind();
        }

        where = "body_fangwen<10000";
        this.Repeater1.DataSource = WebBase.CacheRepository.forum_body.GetPaged(where, "body_fangwen desc", 0, 6);
        this.Repeater1.DataBind();

        where = "body_fangwen<800";
        this.Repeater2.DataSource = WebBase.CacheRepository.forum_body.GetPaged(where, "body_fangwen desc", 0, 4);
        this.Repeater2.DataBind();

        where = "body_fangwen<12000";
        this.Repeater3.DataSource = WebBase.CacheRepository.forum_body.GetPaged(where, "body_fangwen desc", 0, 30);
        this.Repeater3.DataBind();

        this.Repeater_tag.DataSource = WebBase.CacheRepository.forum_tags.GetPaged("", "Tag_Count desc", 0, 20);
        this.Repeater_tag.DataBind();
    }

}
